package com.shop.controller;

import com.shop.interceptor.LoginInterceptor;
import com.shop.pojo.oms.Oms_Order;
import com.shop.pojo.ums.Ums_Member;
import com.shop.service.Oms_Order_Service;
import com.shop.utils.R;
import com.shop.vo.OrderConfirmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

@RestController
@RequestMapping("/orderweb")
public class OrderWebController {

    @Autowired
    Oms_Order_Service oms_order_services;


    /**
     * 点击结算时先进行用户是否登录判断
     * @return
     */
    @GetMapping("/getLoginStatus")
    public R getLoginStatus(){
        Ums_Member ums_member = LoginInterceptor.loginUser.get();
        if(ums_member != null){
            return R.success();
        }
        return R.error(500,"请先登录");
    }


    /**
     * 订单确认页面返回需要用到的数据
     * @return
     */
    @GetMapping("/confirmOrder")
    public R confirmOrder() throws ExecutionException, InterruptedException {
        return  oms_order_services.confirmOrder();
    }




}
